package EjemploJColorChooser;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFrame;

public class Clase extends JFrame implements ActionListener{

	private JButton boton;
	private Color color;
	
	public Clase() {
		
		super("ejemplo JColorChooser");
		this.setSize(300,300);
		this.setVisible(true);
		this.setLayout(new BorderLayout());
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		boton = new JButton("color");
		this.add("South",boton);
		boton.addActionListener(this);
		
	}

	public static void main(String[] args) {
		Clase clase = new Clase();

	}

	
	public void actionPerformed(ActionEvent e){
        JColorChooser Selectorcolor=new JColorChooser();
        color=Selectorcolor.showDialog(null, "Seleccione un Color", Color.BLUE);
        boton.setBackground(color);
 }


}
